import request from '@/utils/request'
import requestMy from '@/utils/requestMy'

export function getFromBilibili(query) {
  return requestMy({
    url: '/articles/getFromBilibili',
    method: 'post',
    params: query
  })
}

export function updateFromBilibili(query) {
  return requestMy({
    url: '/articles/updateFromBilibili',
    method: 'post',
    params: query
  })
}

export function uptokenURL() {
  return requestMy({
    url: '/articles/uptokenURL',
    method: 'get',
  })
}



export function getArticleList(query) {
  return requestMy({
    url: '/articles',
    method: 'get',
    params: query
  })
}

export function getOneArticle(id,query) {
  return requestMy({
    url: '/articles/'+id,
    method: 'get',
    params: query
  })
}

export function getArticleListCount(query) {
  return requestMy({
    url: '/articles/count',
    method: 'get',
    params: query
  })
}

export function fetchList(query) {
  return request({
    url: '/article/list',
    method: 'get',
    params: query
  })
}

export function fetchArticle(id) {
  return request({
    url: '/article/detail',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(pv) {
  return request({
    url: '/article/pv',
    method: 'get',
    params: { pv }
  })
}

export function createArticle(data) {
  return requestMy({
    url: '/articles',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return requestMy({
    url: '/articles',
    method: 'put',
    data
  })
}


